import Son from './03-son2Father-son'
import {useState} from 'react'

interface States {
  name: string,
  age: number,
  isMine: boolean,
}

function App() {
  

  let [state, setState] = useState<States>({
    name: 'black',
    age: 22,
    isMine: true
  })

  const handleBack = (backName: string, backAge: number, backIsMine: boolean) => {
    setState({
      name: backName,
      age: backAge,
      isMine: backIsMine
    })
  } 
  return (
    <>
      <Son name={state.name} age={state.age} isMine={state.isMine} onReturnMsg={handleBack}></Son>
      <div> 父组件状态: {state.name} - {state.age} - {state.isMine ? 'true' : 'false'} </div>
    </>
  )
}

export default App
